﻿Public Class SplashScreen

    Dim themsgboxresult1 As New Microsoft.VisualBasic.MsgBoxResult

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim interopWMP As Boolean = My.Computer.FileSystem.FileExists(Application.StartupPath & "\Interop.WMPLib.dll")
        Dim axinteropWMP As Boolean = My.Computer.FileSystem.FileExists(Application.StartupPath & "\AxInterop.WMPLib.dll")

        If interopWMP = True And axinteropWMP = True Then
            Label1.Text = "Starting BBrowser..."
            BrowserWithoutTabs1.Show()
            Timer2.Enabled = True
            Timer2.Start()
            Timer1.Stop()
            Timer1.Enabled = False
        Else
            Timer1.Stop()
            Timer1.Enabled = False
            Label1.Text = "Startup Failed - Some required files are missing!"
            themsgboxresult1 = MsgBox("Some Files Required by BBrowser are missing. BBrowser can't run without them.", MsgBoxStyle.Critical, "Error!")
            If themsgboxresult1 = MsgBoxResult.Ok Then
                Me.Close()
                Exit Sub
            End If
        End If
    End Sub

    Private Sub SplashScreen_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Timer1.Enabled = True
        Timer1.Start()
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Timer2.Stop()
        Hide()
        Timer2.Enabled = False
        Me.Close()
    End Sub
End Class